import pers.cz.commons.datasource.DataSourceDev;
import com.huaban.analysis.jieba.JiebaSegmenter;
import com.qianxinyao.analysis.jieba.keyword.Keyword;
import com.qianxinyao.analysis.jieba.keyword.TFIDFAnalyzer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.testng.annotations.Test;

import java.util.List;

/**
 * @program: PostGirl-panent
 * @description: testCache
 * @author: Cheng Zhi
 * @create: 2021-04-22 11:14
 **/
@SpringBootTest
public class testCache {

    @Autowired
    private DataSourceDev dev;

    @Value("${minio.test1.ip}")
    private String ip;
    @Test
    public void test1() {

        System.out.println("test_start");
    }

    @Test
    public void test2() {
        System.out.println(ip);
    }

    @Test
    public void test3() {
        JiebaSegmenter segmenter = new JiebaSegmenter();
        List<String> strings = segmenter.sentenceProcess("成智是个好孩子");
        int topN=5;
        TFIDFAnalyzer tfidfAnalyzer=new TFIDFAnalyzer();
        List<Keyword> list=tfidfAnalyzer.analyze("成智是个好孩子",topN,true);
        for(Keyword word:list)
            System.out.println(word.getName()+":"+word.getTfidfvalue()+",");
        System.out.println(strings);
    }

    @Test
    public void test4() {
        System.out.println(dev.getPassword());

    }

/*    private void random(String expression, String title)
            throws RegexpIllegalException, TypeNotMatchException, UninitializedException {

        System.out.println(title + " " + expression);
        Node node = new OrdinaryNode(expression);
        Pattern pattern = Pattern.compile(node.getExpression());
        for (int i = 0; i < 10; i++) {
            String data = node.random();
            System.out.println("[" + pattern.matcher(data).matches() + "] " + data);
        }
        System.out.println();
    }*/

    public static void main(String[] args) throws InterruptedException {
        String pid = "12345\n\n";
        System.out.println(pid);
        System.out.println("--");
        System.out.println(pid.replaceAll("\r|\n", ""));
        System.out.println("--");
    }
}
